#include "test_pthread.h"

Counter::Counter(const int value) :value(value) {}

void Counter::increment(void)
{
    std::lock_guard<std::mutex> lock(mtx);

    std::thread::id tmpThreadId = std::this_thread::get_id();


    std::stringstream ss;
    ss << tmpThreadId;
    ++this->value;
    std::cout << "Incremented: " << this->value << "\t\tmy pthread id: " << ss.str() << std::endl;

}

int Counter::getValue(void)
{
    std::lock_guard<std::mutex> _lock(mtx);
    return this->value;
}

